package javase.jmx.examples.standart;

import java.lang.management.ManagementFactory;

import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;

public class StandartAgent {

	public static void main(String[] args) throws MalformedObjectNameException, NullPointerException, 
												  InstanceAlreadyExistsException, MBeanRegistrationException, 
												  NotCompliantMBeanException, InterruptedException {
		MBeanServer server = ManagementFactory.getPlatformMBeanServer();
	    ObjectName name = new ObjectName("javase.jmx.examples.standart:type=HelloWorld"); 
	    HelloWorld mbean = new HelloWorld(); 
	    server.registerMBean(mbean, name); 
	      
	    System.out.println("Waiting forever..."); 
	    Thread.sleep(Long.MAX_VALUE); 

	}

}
